#include <bits/stdc++.h>
using namespace std;

int divisorsum(int n){
    int res = 0;
    for(int i = 1; i * i <= n; ++i){
        if(n % i != 0) continue;
        if(i * i != n && i != 1){
            res += i;
            res += n / i;
        }else {
            res += i;
        }
    }
    return res;
}

int main(){
    int n, m;
    while(cin >> n >> m){
        if(divisorsum(n) == m && divisorsum(m) == n){
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }

}